let creditNumber= document.querySelector('.credit-number')
let creditPrice= document.querySelector('.credit-price')
let creditTimes= document.querySelector('.credit-times')

function rData(){
    let data = [
    {"count": 4000, "price": 1200, "unitPrice": "0.3000"},
    {"count": 8000, "price": 2000,"unitPrice": "0.2500" },
    {"count": 40000, "price": 8000, "unitPrice": "0.2000" }
   ]

    let rArray=''
    data.forEach(function(dom,i){
        rArray+=`
        <li class="${i===0? 'active':''}" data-price=${dom.price} data-unit-price=${dom.unitPrice}>${dom.count}次</li>  
        `
    })
    creditNumber.innerHTML=rArray
}

rData()

creditNumber.addEventListener('click',function(e){
    if(e.target.nodeName==='LI'){
        for(let i=0; i<creditNumber.children.length; i++){
            creditNumber.children[i].className=''
        };
        e.target.className='active'
        creditPrice.textContent= e.target.dataset.price
        creditTimes.textContent= e.target.dataset.unitPrice
    }
})

rModal('.APIdoc-list li','.APIdoc-left .APIdoc-lchoose')

window.onload = function() {
    //配置
    var config = {
        vx: 4,	//小球x轴速度,正为右，负为左
        vy: 4,	//小球y轴速度
        height: 2,	//小球高宽，其实为正方形，所以不宜太大
        width: 2,
        count: 150,		//点个数
        color: "#ccc", 	//点颜色
        stroke: "#eeeeee", 		//线条颜色
        dist: 6000, 	//点吸附距离
        e_dist: 20000, 	//鼠标吸附加速距离
        max_conn: 10 	//点到点最大连接数
    }

    //调用
    CanvasParticle(config);
}

